<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-1.12.4.js"></script>
</head>
<body>
<button onclick="getUserInfo()">获取用户信息</button>
<div id="dv1"></div>

</body>
<script>
    function getUserInfo() {
        var datamsg={id:1001,username:"tom",userpwd:"123456",useraddress:"青岛"};
        var myjson=JSON.stringify(datamsg);
        console.log(datamsg)
        console.log(myjson)
        $.ajax({
            type:"post",
            url:"/getUserInfoById",
            data:myjson,
            dataType:"json",
            contentType:"application/json;charset=UTF-8",
            success:function (response) {
                console.log($("#dv1"))
                console.log(response)
                // alert("服务器接收到并响应"+response);
                $("#dv1").html(response.username)
            }
        })


    }
</script>
</html>